<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath %>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="css/my.css">
<link rel="stylesheet" type="text/css" href="css/my_right.css">
 	 <script language="javascript">

	function openAction(){ 
			window.open('email/send_email.jsp','写邮件','scrollbars=yes,width=800,height=600,alwaysRaised=1'); 
		} 

   function docheck_dlt(){
   	   var items=document.getElementsByTagName("input"); 
   	   var sum=0;
       for(var i=0;i<items.length;i++){  
         if(items[i].type == "checkbox" && items[i].checked==true)sum=sum+1;   
       }
   	   if(sum==0){alert("请选择要删除的邮件！");return false;}
   	   else {
   	   	 return true;
   	   }
   }
   function checkall(obj){//
   	   if(obj.checked==true){
   	      var items=document.getElementsByTagName("input");
   	      for(var i=0;i<items.length;i++){  
            if(items[i].type == "checkbox") items[i].checked=true   
          }
   	   }else{
   	   	  var items=document.getElementsByTagName("input");
   	      for(var i=0;i<items.length;i++){  
            if(items[i].type == "checkbox") items[i].checked=false;  
          } 
   	   }   
   }
 
   </script>
</head>
<body>
<div id='header'>			
	<jsp:include page="../common/header.jsp"></jsp:include>
</div>
<div id='main_play'>
	<div id='main_left'>
		<jsp:include page="../common/my_left.jsp"></jsp:include>
	</div>
	<div id='main_right' align="left">
		<div id="right_local">

			<div id="待定">
			<table border="1" bordercolor="#222222" cellspacing="0"
				cellpadding="2" width="600" align="right"
				style='border-collapse: collapse;'>
				<tr>
					<td>
						<table bordercolor="#ccffcc" width="600" cellspacing="0"
							cellpadding="0" style='border-collapse: collapse'>
							<tr>
								<td align="center" background="../images/bigpic_bg.png">
									<img src="../images/showmessage_1.gif">
									&nbsp
									<font size="5" color="#000000" face="华文彩云">查看邮件&nbsp </font>
								</td>
							</tr>
							<tr>
								<td>
									<form action="email.do?method=deleteAll" name="email" id="email" method="post">
										<table width="600" border="1" bordercolor="#aaaaaa"
											cellspacing="0"
											style='border-collapse: collapse; table-layout: fixed; word-wrap: break-word;'>
											<tr>
												<td width=""></td>
												<td width=""></td>
												<td width=""></td>
												<td width=""></td>
												<td width=""></td>
												<td width=""></td>
											</tr>
											<tr>
												<td height="25" background="./images/searchbg.jpg"
													colspan="6" align="left">
													
													<b>[操作菜单]</b>&nbsp
													<input type="button" value="写邮件" style="width: 80px" onclick="openAction();">
													&nbsp
													<input type="submit" value="删  除" style="width: 80px" onclick="javascript:return docheck_dlt();">
													&nbsp
													<input type="button" value="刷  新" style="width: 80px" onclick=javascript:location.reload();>
												</td>
											</tr>
										</table>
										<br />
										<table width="600" border="1" bordercolor="#aaaaaa"
											cellspacing="0"
											style='border-collapse: collapse; table-layout: fixed; word-wrap: break-word;'>
											<tr bgcolor="#ffffff">
												<td align="center" width=""
													background="./images/itembg.jpg">
													<b><input type="checkbox"
															onclick=javascript:checkall(this);>全选</b>
												</td>
												<td align="center" width=""
													background="./images/itembg.jpg">
													<b>状态</b>
												</td>
												<td align="center" width=""
													background="./images/itembg.jpg">
													<b>发 送 者</b>
												</td>
												<td align="center" width=""
													background="./images/itembg.jpg">
													<b>标 题</b>
												</td>
												<td align="center" width=""
													background="./images/itembg.jpg">
													<b>发送时间</b>
												</td>
												<td align="center" width=""
													background="./images/itembg.jpg">
													<b>内容大小</b>
												</td>
											</tr>
											<c:forEach var="email" items="${emails}" >
											<tr bgcolor="">
												<td align="center" width="">
													<input type="checkbox" name="ids" id="check" value="${email.id}" />
												</td>
												<td align="center" width="">
												<a href="javascript:void(0)" onclick="javascript:window.open('email.do?method=get&emaiId=${email.id}','写邮件','scrollbars=yes,width=800,height=600,alwaysRaised=1')">
													<c:if test="${email.read_flag==1}"><img src="./images/unRd.gif"/> </c:if>
													<c:if test="${email.read_flag==0}"><img src="./images/hasRd.gif"/> </c:if>
												</a>
												</td>
												
                                      			<td align="center" width="">
                                      				${email.id }
													${email.sender }
												</td>
												<td align="center" width="">
													${email.title }
												</td>
												<td align="center" width="">
													<font size='2'>&nbsp 
														${email.time}
													</font>
												</td>
												<td align="center" width="">
													&nbsp ${fn:length(email.content)}
													字数
												</td>
											</tr>
											</c:forEach>
										</table>
										<br />
									</form>
								</td>
							</tr>
						</table>
					</td>
				</tr>
				
			</table>
			<a href="email.do?method=find&pageNo=1">首页</a>
			<c:if test="${page.currentPageNo>1}">
			<a href="email.do?method=find&pageNo=${page.currentPageNo-1}">上一页</a>
			</c:if>
			<c:if test="${page.currentPageNo<page.totalPageNo}">
			<a href="email.do?method=find&pageNo=${page.currentPageNo+1 }">下一页</a>
			</c:if>
			<a href="email.do?method=find&pageNo=${page.totalPageNo}">末页</a>
		</div>
		</div>
	</div>
</div>
<div id='footer'></div>





</body>
</html>